package demo08;

import java.util.ArrayList;
import java.util.Random;

public class Manager extends User {

    public Manager(String name, int money) {
        super(name,money);
    }
    public Manager() {
        super();
    }

    public void show(){
        System.out.println("我叫："+super.getName()+",我有多少钱:"+super.getMoney());
    }

    public ArrayList<Integer> luckRead(int totalMoney,int count){
        ArrayList<Integer> list=new ArrayList<>();
        //定义循环次数 ，总个数-1
        int time=count-1;
        super.setMoney(super.getMoney()-totalMoney);
        Random r=new Random();
        for(int i=0;i<time;i++){
            int moenys=r.nextInt(totalMoney/count*2)+1;
            list.add(moenys);
            totalMoney-=moenys;
            count--;
        }
        //剩余的金额
        list.add(totalMoney);
        return list;
    }
}
